package com.code.entity;

import com.code.enums.CodeGenerateType;
import com.code.entity.metadata.Table;
import lombok.Data;

@Data
public class GenerateDescriptor {

    private String destination;
    private String module;
    private boolean useProvider;
    private Table table;
    private String basePackage;

    private String commonPackage;
    private CodeGenerateType[] generateTypes;


    public String getCommonPackage() {
        return commonPackage;
    }

    public void setCommonPackage(String commonPackage) {
        this.commonPackage = commonPackage;
    }

    public static GenerateDescriptorBuilder builder() {
        return new GenerateDescriptorBuilder();
    }

    public String getDestination() {
        return destination;
    }

    public String getModule() {
        return module;
    }

    public boolean isUseProvider() {
        return useProvider;
    }

    public Table getTable() {
        return table;
    }

    public String getBasePackage() {
        return basePackage;
    }

    public CodeGenerateType[] getGenerateTypes() {
        return generateTypes;
    }

    public static class GenerateDescriptorBuilder {
        private GenerateDescriptor descriptor;

        GenerateDescriptorBuilder() {
            this.descriptor = new GenerateDescriptor();
        }

        public GenerateDescriptorBuilder destination(String destination) {
            descriptor.destination = destination;
            return this;
        }

        public GenerateDescriptorBuilder module(String module) {
            descriptor.module = module;
            return this;
        }

        public GenerateDescriptorBuilder useProvider(boolean useProvider) {
            descriptor.useProvider = useProvider;
            return this;
        }

        public GenerateDescriptorBuilder table(Table table) {
            descriptor.table = table;
            return this;
        }

        public GenerateDescriptorBuilder basePackage(String basePackage) {
            descriptor.basePackage = basePackage;
            return this;
        }
        public GenerateDescriptorBuilder commonPackage(String commonPackage) {
            descriptor.commonPackage = commonPackage;
            return this;
        }
        public GenerateDescriptorBuilder generateTypes(CodeGenerateType[] generateTypes) {
            descriptor.generateTypes = generateTypes;
            return this;
        }

        public GenerateDescriptor build() {
            return this.descriptor;
        }
    }
}
